import request from "@/request";

//http://127.0.0.1:9292/api/cart/cartList
export const getCartList = ()=>request.get("/cart/cartList");

// 加入购物车:http://127.0.0.1:8092/api/cart/addToCart/:skuId/:buyNum
export const postAddToCart = (skuId,buyNum)=>request.post(`/cart/addToCart/${skuId}/${buyNum}`);

// 切换选中项:http://127.0.0.1:9292/api/cart/checkCart/:cartId/:isChecked
export const getCheckCart = (cartId,isChecked)=>request(`/cart/checkCart/${cartId}/${isChecked?1:0}`);
//根据id删除购物车中的商品 , 单个删除
//http://127.0.0.1:9292/api/cart/deleteCart/:id
export const deleteCartGoods = (id)=>request.delete(`/cart/deleteCart/${id}`);
//删除购物车的所有选中的商品
//http://127.0.0.1:9292/api/cart/batchDeleteCart
export const postDeleteCart = (idArr)=>request.post('/cart/batchDeleteCart', idArr);
//全选或全不选
//http://127.0.0.1:9292/api/cart/batchCheckCart/:isChecked
export const postCheckAll = (isChecked,idArr)=>request.post(`/cart/batchCheckCart/${isChecked}`,idArr);